package com.levy.common.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.levy.entity.Customer;
import com.levy.service.CustomerService;

@Controller
public class CustomerController {
	
	@Autowired
	private CustomerService customerService;
	
	private Logger logger = LoggerFactory.getLogger(CustomerController.class);  
 
	@RequestMapping(value="/customer", method = RequestMethod.GET)
	public String printWelcome(ModelMap model) {
 
		Customer customer =customerService.getCustomerById(1);
	
		model.addAttribute("customer", customer);
		model.addAttribute("name", customer.getId());
		logger.debug("hello");
		return "customer";
 	}	
}